package cn.hnu.jpa.jpaExample.ManyToOne.SingleWay;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

@Entity
public class ManyAddress implements Serializable{

	/**
	 * 多对一，顾客和地址之间  多个地址可能是一个顾客的  但顾客实体中并不包含地址属性
	 */
	private static final long serialVersionUID = 1L;

	private Integer id;
	
	private String addr;
	
	private ManyCustomer customer;

	@Id @GeneratedValue(strategy = GenerationType.AUTO)
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getAddr() {
		return addr;
	}

	public void setAddr(String addr) {
		this.addr = addr;
	}

	@ManyToOne(cascade = {CascadeType.ALL})
	@JoinColumn(name="cus_id")
	public ManyCustomer getCustomer() {
		return customer;
	}

	public void setCustomer(ManyCustomer customer) {
		this.customer = customer;
	}
	
	
	
}
